<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>chigraph: lib/support/include/chi/Support/Flags.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="chigraphDoxygenIcon.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">chigraph
   &#160;<span id="projectnumber">master</span>
   </div>
   <div id="projectbrief">Systems programming language written for beginners in LLVM</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('Flags_8hpp_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Flags.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="Flags_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#pragma once</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;</div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#ifndef CHI_SUPPORT_FLAGS_HPP</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#define CHI_SUPPORT_FLAGS_HPP</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;</div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &lt;type_traits&gt;</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;</div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacechi.html">chi</a> {</div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> Enum&gt;</div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="structchi_1_1Flags.html">   26</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structchi_1_1Flags.html">Flags</a> {</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    static_assert(std::is_enum&lt;Enum&gt;::value, <span class="stringliteral">&quot;Template argument to flags must be an enum&quot;</span>);</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <a class="code" href="structchi_1_1Flags.html#a423fb4774ea141fbdb47a78136115cdc">Flags</a>() = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="structchi_1_1Flags.html#ab878bfabc2bcf18f92072fd9d5b60c3c">   34</a></span>&#160;    <a class="code" href="structchi_1_1Flags.html#ab878bfabc2bcf18f92072fd9d5b60c3c">Flags</a>(Enum e) : mData{<span class="keyword">static_cast&lt;</span>decltype(mData)<span class="keyword">&gt;</span>(e)} {}</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    <a class="code" href="structchi_1_1Flags.html#a423fb4774ea141fbdb47a78136115cdc">Flags</a>(<span class="keyword">const</span> <a class="code" href="structchi_1_1Flags.html">Flags</a>&amp; fl) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <a class="code" href="structchi_1_1Flags.html#a423fb4774ea141fbdb47a78136115cdc">Flags</a>(<a class="code" href="structchi_1_1Flags.html">Flags</a>&amp;&amp; fl) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <a class="code" href="structchi_1_1Flags.html">Flags</a>&amp; <a class="code" href="structchi_1_1Flags.html#a11c8f2e11b96dce3b105a14c14870cf4">operator=</a>(<span class="keyword">const</span> <a class="code" href="structchi_1_1Flags.html">Flags</a>&amp; fl) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    <a class="code" href="structchi_1_1Flags.html">Flags</a>&amp; <a class="code" href="structchi_1_1Flags.html#a11c8f2e11b96dce3b105a14c14870cf4">operator=</a>(<a class="code" href="structchi_1_1Flags.html">Flags</a>&amp;&amp; fl) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="structchi_1_1Flags.html#a6ee1e505bf9181403ec98fdb0555230d">   57</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="structchi_1_1Flags.html#a6ee1e505bf9181403ec98fdb0555230d">operator==</a>(<span class="keyword">const</span> <a class="code" href="structchi_1_1Flags.html">Flags</a>&amp; rhs)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mData == rhs.mData; }</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;</div><div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="structchi_1_1Flags.html#a79539b7330a1ef1f67f0ce203edb40e1">   61</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="structchi_1_1Flags.html#a79539b7330a1ef1f67f0ce203edb40e1">operator!</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mData == 0; }</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div><div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="structchi_1_1Flags.html#a88ae58afc2e6da613fe21851095efdde">   66</a></span>&#160;    <span class="keyword">explicit</span> <span class="keyword">operator</span> bool()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mData != 0; }</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div><div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="structchi_1_1Flags.html#a11ee20d313c7590c6f00127d9fe35b64">   71</a></span>&#160;    <a class="code" href="structchi_1_1Flags.html">Flags</a> <a class="code" href="structchi_1_1Flags.html#a11ee20d313c7590c6f00127d9fe35b64">operator|</a>(<span class="keyword">const</span> <a class="code" href="structchi_1_1Flags.html">Flags</a>&amp; rhs)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="structchi_1_1Flags.html">Flags</a>{mData | rhs.mData}; }</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;</div><div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="structchi_1_1Flags.html#af385da323047a5c2dc29be162dd647d5">   76</a></span>&#160;    <a class="code" href="structchi_1_1Flags.html">Flags</a> <a class="code" href="structchi_1_1Flags.html#af385da323047a5c2dc29be162dd647d5">operator&amp;</a>(<span class="keyword">const</span> <a class="code" href="structchi_1_1Flags.html">Flags</a>&amp; rhs)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="structchi_1_1Flags.html">Flags</a>{mData &amp; rhs.mData}; }</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;</div><div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="structchi_1_1Flags.html#a1b135b1d822e9d03d2ac3ceb5f2f2b19">   81</a></span>&#160;    <a class="code" href="structchi_1_1Flags.html">Flags</a>&amp; <a class="code" href="structchi_1_1Flags.html#a1b135b1d822e9d03d2ac3ceb5f2f2b19">operator|=</a>(<span class="keyword">const</span> <a class="code" href="structchi_1_1Flags.html">Flags</a>&amp; rhs) {</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;        mData |= rhs.mData;</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;        <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    }</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;</div><div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="structchi_1_1Flags.html#a8191559b93fead009e43b6300f1383a5">   89</a></span>&#160;    <a class="code" href="structchi_1_1Flags.html">Flags</a>&amp; <a class="code" href="structchi_1_1Flags.html#a8191559b93fead009e43b6300f1383a5">operator&amp;=</a>(<span class="keyword">const</span> <a class="code" href="structchi_1_1Flags.html">Flags</a>&amp; rhs) {</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        mData &amp;= rhs.mData;</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;        <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    }</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    <a class="code" href="structchi_1_1Flags.html#a423fb4774ea141fbdb47a78136115cdc">Flags</a>(<span class="keyword">typename</span> std::underlying_type&lt;Enum&gt;::type data) : mData{data} {}</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    <span class="keyword">typename</span> std::underlying_type&lt;Enum&gt;::type mData = 0;</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;};</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;}  <span class="comment">// namespace chi</span></div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;<span class="preprocessor">#endif  // CHI_SUPPORT_FLAGS_HPP</span></div><div class="ttc" id="structchi_1_1Flags_html_a8191559b93fead009e43b6300f1383a5"><div class="ttname"><a href="structchi_1_1Flags.html#a8191559b93fead009e43b6300f1383a5">chi::Flags::operator &amp;=</a></div><div class="ttdeci">Flags &amp; operator &amp;=(const Flags &amp;rhs)</div><div class="ttdoc">Bitwise AND assignment. </div><div class="ttdef"><b>Definition:</b> <a href="Flags_8hpp_source.html#l00089">Flags.hpp:89</a></div></div>
<div class="ttc" id="structchi_1_1Flags_html_a6ee1e505bf9181403ec98fdb0555230d"><div class="ttname"><a href="structchi_1_1Flags.html#a6ee1e505bf9181403ec98fdb0555230d">chi::Flags::operator==</a></div><div class="ttdeci">bool operator==(const Flags &amp;rhs) const</div><div class="ttdoc">See if one Flags object is equal to the other. </div><div class="ttdef"><b>Definition:</b> <a href="Flags_8hpp_source.html#l00057">Flags.hpp:57</a></div></div>
<div class="ttc" id="structchi_1_1Flags_html_a1b135b1d822e9d03d2ac3ceb5f2f2b19"><div class="ttname"><a href="structchi_1_1Flags.html#a1b135b1d822e9d03d2ac3ceb5f2f2b19">chi::Flags::operator|=</a></div><div class="ttdeci">Flags &amp; operator|=(const Flags &amp;rhs)</div><div class="ttdoc">Bitwise OR assignment. </div><div class="ttdef"><b>Definition:</b> <a href="Flags_8hpp_source.html#l00081">Flags.hpp:81</a></div></div>
<div class="ttc" id="structchi_1_1Flags_html_af385da323047a5c2dc29be162dd647d5"><div class="ttname"><a href="structchi_1_1Flags.html#af385da323047a5c2dc29be162dd647d5">chi::Flags::operator &amp;</a></div><div class="ttdeci">Flags operator &amp;(const Flags &amp;rhs) const</div><div class="ttdoc">Bitwise AND. </div><div class="ttdef"><b>Definition:</b> <a href="Flags_8hpp_source.html#l00076">Flags.hpp:76</a></div></div>
<div class="ttc" id="structchi_1_1Flags_html"><div class="ttname"><a href="structchi_1_1Flags.html">chi::Flags</a></div><div class="ttdoc">A template class for type-safe flags. </div><div class="ttdef"><b>Definition:</b> <a href="Flags_8hpp_source.html#l00026">Flags.hpp:26</a></div></div>
<div class="ttc" id="structchi_1_1Flags_html_a11ee20d313c7590c6f00127d9fe35b64"><div class="ttname"><a href="structchi_1_1Flags.html#a11ee20d313c7590c6f00127d9fe35b64">chi::Flags::operator|</a></div><div class="ttdeci">Flags operator|(const Flags &amp;rhs) const</div><div class="ttdoc">Bitwise OR. </div><div class="ttdef"><b>Definition:</b> <a href="Flags_8hpp_source.html#l00071">Flags.hpp:71</a></div></div>
<div class="ttc" id="structchi_1_1Flags_html_a423fb4774ea141fbdb47a78136115cdc"><div class="ttname"><a href="structchi_1_1Flags.html#a423fb4774ea141fbdb47a78136115cdc">chi::Flags::Flags</a></div><div class="ttdeci">Flags()=default</div><div class="ttdoc">Default constructor. </div></div>
<div class="ttc" id="namespacechi_html"><div class="ttname"><a href="namespacechi.html">chi</a></div><div class="ttdoc">The namespace where chigraph lives. </div><div class="ttdef"><b>Definition:</b> <a href="BitcodeParser_8hpp_source.html#l00012">BitcodeParser.hpp:12</a></div></div>
<div class="ttc" id="structchi_1_1Flags_html_a79539b7330a1ef1f67f0ce203edb40e1"><div class="ttname"><a href="structchi_1_1Flags.html#a79539b7330a1ef1f67f0ce203edb40e1">chi::Flags::operator!</a></div><div class="ttdeci">bool operator!() const</div><div class="ttdoc">See if one Flags object isn&amp;#39;t equal to the other. </div><div class="ttdef"><b>Definition:</b> <a href="Flags_8hpp_source.html#l00061">Flags.hpp:61</a></div></div>
<div class="ttc" id="structchi_1_1Flags_html_ab878bfabc2bcf18f92072fd9d5b60c3c"><div class="ttname"><a href="structchi_1_1Flags.html#ab878bfabc2bcf18f92072fd9d5b60c3c">chi::Flags::Flags</a></div><div class="ttdeci">Flags(Enum e)</div><div class="ttdoc">Constructor from an Enum type. </div><div class="ttdef"><b>Definition:</b> <a href="Flags_8hpp_source.html#l00034">Flags.hpp:34</a></div></div>
<div class="ttc" id="structchi_1_1Flags_html_a11c8f2e11b96dce3b105a14c14870cf4"><div class="ttname"><a href="structchi_1_1Flags.html#a11c8f2e11b96dce3b105a14c14870cf4">chi::Flags::operator=</a></div><div class="ttdeci">Flags &amp; operator=(const Flags &amp;fl)=default</div><div class="ttdoc">Copy assignment. </div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_97aefd0d527b934f1d99a682da8fe6a9.html">lib</a></li><li class="navelem"><a class="el" href="dir_2e3059805f6f515f917d8ef98610afb5.html">support</a></li><li class="navelem"><a class="el" href="dir_8f6158c6375c7a928f205956f43cc53b.html">include</a></li><li class="navelem"><a class="el" href="dir_15506f16d8a27e5f24c5f11d43b99347.html">chi</a></li><li class="navelem"><a class="el" href="dir_69eae05ff7476524364d958d7a05777f.html">Support</a></li><li class="navelem"><a class="el" href="Flags_8hpp.html">Flags.hpp</a></li>
    <li class="footer">Generated on Sat Sep 16 2017 17:41:35 for chigraph by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
